function getLoginToken(userID, appid) {
    let { tokenURL,cgi_token} = getApp().globalData;
    return new Promise((res, rej) => {
        wx.request({
            url: tokenURL, //仅为示例，并非真实的接口地址
            data: {
                app_id: appid,
                id_name: userID,
                cgi_token
            },
            header: {
                'content-type': 'text/plain'
            },
            success(result) {
              let token = result.data.d.token
              console.log(token)
              console.log(">>>[liveroom-room] get login token success. token is: " + token);
              if (result.data.s == false) {
                    return;
                }
              res(token);
            },
            fail(e) {
                console.log(">>>[liveroom-room] get login token fail, error is: ")
                console.log(e);
                rej(e)
            }
        });
    });
}

module.exports = {
    getLoginToken
};